home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / COMMUNIC / BULLETIN / 0157.ZIP / GENERIC.DOC < prev    next >
Text File  |  1985-11-14  |  9KB  |  249 lines

  1.  
  2.     GENERIC FIDO DRIVER INTERFACE
  3.     T. Jennings 12 July 1985
  4.  
  5.     FIDO_GEN.EXE is a "generic" Fido for otherwise unsupported
  6.     machines. It will not work until you write a device driver
  7.     or terminate-stay-resident program to provide the following
  8.     functions. The format of this driver will remain independent
  9.     of the Fido version; once written it will work with all
  10.     future Fido versions.
  11.  
  12.     All IO is done through an IBM PC like Interrupt 14 hex. Many
  13.     calls are directly compatible, but you will have to extend
  14.     it to support the added features. Note that FIDO_GEN will
  15.     NOT run on an IBM PC as is.
  16.  
  17.     The interface is very consistent; AX and DX are used for
  18.     all functions.
  19.  
  20.     It is possible to use an entirely polled IO system for
  21.     Fido; Fido does "typeahead" in the higher level software,
  22.     so everything but ASCII Upload will work fine polled, and
  23.     even that may work OK on most machines. Interrupt character
  24.     input is very desireable. Interrupt output is not needed
  25.     at all, unless you wish to run under a multi-tasker such
  26.     as Multilink.
  27.  
  28.     Please note that I cannot help you write drivers, nor will
  29.     I help you debug them. You are on your own! Extensive
  30.     assembly language experience is needed, and a good degree
  31.     of familiarity with your hardware, so please do not
  32.     underestimate the difficulty of this task.
  33.  
  34.     Assumptions here are that you can run MSDOS or PCDOS
  35.     version 2 or 3; Fido does not support ANY other operating
  36.     system.
  37.  
  38.     Either a device driver or a terminate-stay-resident type
  39.     structure for your driver set is reccomended. Device drivers
  40.     obviously go in your CONFIG.SYS on the boot disk; term stay
  41.     res programs should be put in AUTOEXEC.BAT, to be run only 
  42.     ONCE. Every time you run a term stay res, it consumes more
  43.     memory, unless special provision is made in your program
  44.     to detect whether it was previously loaded. Keep in mind that
  45.     in normal operation, Fido is run more than once, ie. you may
  46.     Control-C Fido to copy files, run in Test Mode, etc.
  47.  
  48.     On the subject of Test Mode, an important note: Fido does not
  49.     make ANY HARDWARE DEPENDENT CALLS in /T test mode. This means
  50.     that ANY version of Fido will work on ANY other machine in
  51.     test mode. You must run it without /T specified in order to
  52.     get it to use your drivers. Test mode is useless as a test of
  53.     your drivers. It means nothing.
  54.  
  55.     It is probably a good idea to test each and every single 
  56.     function before attempting to use Fido with your driver set;
  57.     I repeat, I cannot help you with your drivers in any way.
  58.  
  59.  
  60.     The following is the function call used internally to Fido
  61.     to access the drivers you write. This is provided for your
  62.     information only. 
  63.  
  64.     val= int14(ah,al,dx);
  65.  
  66.     int val;        /* integer return value */
  67.  
  68.     int ah;            /* command byte, 0 - N */
  69.     int al;            /* argument */
  70.     int dx;            /* I/O device, ie. channel */
  71.  
  72.  
  73.     For all calls, DX is the IO device from the /1, /2, etc
  74.     command line switch. This can be used or ignored as desired.
  75.     It will be valid for all calls at all times.
  76.  
  77.     AH is the command type; 0 - 3 are very similar to IBM PC
  78.     INT 14 calls. 4 and up are extentions to support further
  79.     functions. (Note that the IBM version of Fido does NOT
  80.     use INT 14.)
  81.  
  82.     For all calls, your driver MUST preserve all segment
  83.     registers, plus BP and SP. All other registers can be
  84.     modified. Interrupts should be left ENABLED after 
  85.     returning. There is adequate stack space to do almost
  86.     anything you need; there should be at least a kilobyte
  87.     of stack space.
  88.  
  89.  
  90. AH = 0:    Set baud rate
  91.  
  92.     This command is almost identical to the IBM PC equivalent
  93.     call. The upper three bits indicate the baud rate; the
  94.     lower ones indicate parity (always none) and stop bits 
  95.     (always 1). You can always assume that NO PARITY and ONE
  96.     STOP BIT are used throughout Fido.
  97.  
  98.         Baud    Value
  99.          300    043h
  100.         1200    083h
  101.         2400    0a3h
  102.         9600    0e3h
  103.  
  104.     The sample driver strips off all but the upper three
  105.     bits. You can do this in your driver also, but Fido
  106.     will always pass the byte patterns as defined above.
  107.  
  108.  
  109.  
  110. AH = 1:    Write a character to the serial port
  111.  
  112.     Output the character in AL to the serial port. Wait for 
  113.     output ready as necessary.
  114.  
  115.  
  116.  
  117. AH = 2:    Read a character from the serial port
  118.  
  119.     Return one character from the serial port in AL. Wait for 
  120.     one if necessary.
  121.  
  122.  
  123. AH = 3:    Return status
  124.  
  125.     This command returns various status bits back to Fido in AH
  126.     and AL. There are three status bits you must return in this
  127.     call; two have predetermined values, and the other you can
  128.     assign to any other bit, as it is tested with the command
  129.     line /V value. (See below) These are bit patterns, not
  130.     numeric values; you can (and will) have more than one bit
  131.     set at a time.
  132.  
  133.     AH:    20h        TBE    Transmit Buffer Empty
  134.         01h        RDA    Receive Data Available
  135.  
  136.     TBE means the transmitter is ready to accept a character.
  137.     RDA means there is a character from the modem waiting.
  138.  
  139.     The other bit the the Carrier Detect (CD) bit. This can be
  140.     returned in either AH or AL. The command line switch /V
  141.     defines the mask bit used to test this port. For example,
  142.  
  143.         128/V
  144.  
  145.     Defines the CD mask bit to be 128, or 0080h. This is ANDed
  146.     with the value returned by the STATUS call, and if the 
  147.     result is true (bit is set) then Fido assumes the modem is
  148.     connected.
  149.  
  150.     For making this test, Fido treats AH and AL as a 16 bit
  151.     integer, in the usual fashion: AH is the most signifigant
  152.     and AL the least.  Therefore, 32768/V tests the MSB in
  153.     AH, and 1/V test the LSB in AL. You can't use 8192/V 
  154.     or 256/V, since those are TBE and RDA, respectively.
  155.  
  156.     Unused bits may take on any value as you see fit.
  157.  
  158.  
  159.  
  160. AH = 4:    One time initialization
  161.  
  162.     Perform any necessary one time initialization here. Fido 
  163.     will make this call only ONCE before any IO is done to 
  164.     the serial port. NO OTHER call will ever be made before
  165.     this call. If not needed, ignore.
  166.  
  167.  
  168. AH = 5:    One time UN initialization
  169.  
  170.     Do one time un-initialization; this is called ONCE, just
  171.     before Fido exits to DOS. Remove any interrupt structures
  172.     or whatever were installed by AH = 0. NO OTHER call will be
  173.     mode to the IO drivers after this call.
  174.  
  175.     It is general practice when exiting Fido to leave the 
  176.     DTR line low so that the modem is disabled when Fido 
  177.     is not running. Fido lowers DTR before calling this
  178.     function and exiting, but you might want to make sure that
  179.     this function does not raise it again inadvertantly.
  180.  
  181.  
  182.  
  183. AH = 6:    Raise/Lower Data Terminal Ready
  184.  
  185.     This function controls the state of the DTR line output to
  186.     the modem, usually on Pin 20. AL = 0 means lower DTR; 
  187.     AL = 1 means raise it true. True enables the modem; false
  188.     disables it.
  189.  
  190.     No other functions in your drivers should change the state
  191.     of the DTR line, except AH = 4 and AH = 5. See the note
  192.     in AH = 5 about exiting Fido.
  193.  
  194. AH = 7:    Return Timer Tick parameters
  195.  
  196.     This function is used to tell Fido about the timer tick
  197.     to be used for marking time. This is an extremely critical
  198.     function, and luckily, fairly simple. The hard part will
  199.     be getting the information.
  200.  
  201.     AH = 4 is called before this call, so you can use that to
  202.     start any timer running if necessary; if you do, use AH = 5
  203.     to remove it.
  204.  
  205.     AH = 7 returns three numbers:
  206.  
  207.         AL =     Timer Tick Interrupt Number    0 - 255
  208.         AH =    Ticks Per Second
  209.         DX =     Timer Tick Rate, Milliseconds
  210.  
  211.     Note that this function merely returns fixed values to
  212.     Fido; Fido will do all the work of operating the timer
  213.     interrupt, and pass control to the original interrupt
  214.     service routine. The following information is given
  215.     as background only.
  216.  
  217.     Fido's timer tick is done very simply by inserting itself
  218.     in series with the interrupt numbe you specify in AL. When
  219.     Fido has done its timer counter incrementing, it chains
  220.     via a long jump to the original interrupt vector, thereby
  221.     preserving the original interrupt vector. Fido does not 
  222.     defer the interrupt by more than a few hundred microseconds,
  223.     so there are no problems with interrupt acknowledges
  224.     regardless of the interrupt system type. The DEC Rainbow,
  225.     for instance, has a low tolerance for interrupt deferrment;
  226.     it has hardware to check for interrupt loss, and the screen
  227.     refresh depends on a repeatable clock; Fido's timer tick
  228.     method presents no problem.
  229.  
  230.     The reason for both ticks per second and milliseconds per
  231.     tick is that frequently the timer is at an inconvenient rate;
  232.     the IBM PC for example is approx. 55 mS, which does not make
  233.     for easy counting. (Note that if you work it out, the
  234.     sample drive as supplied is very inaccurate. Oh well.)
  235.  
  236.     Fido counts both milliseconds and hours minutes seconds; these
  237.     two parameters let you choose values that will result in the 
  238.     highest accuracy. It is not necessary to have extreme accuracy.
  239.  
  240.     Fido does its millisecond counting by adding the number you
  241.     return in DX to a 32 bit counter in memory; it is used for
  242.     XMODEM, etc timeouts, and does not need to be highly accurate;
  243.     10% is fine, but try for the most accurate possible.
  244.  
  245.     Hour minute second counting is done with the number your return
  246.     in AH; every (AH) timer tick Fido increments the seconds counter.
  247.     This value should be as accurate as is possible, since this is
  248.     what controls each users time limit on the system.
  249.